using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class P_ButtonManager : MonoBehaviour
{ 
    public Button Home;
    public Button Music;
    public Button Next;
    public Sprite[] MusicSprite;
    private GameObject showGame;
    private GameObject hideGame;
    private bool MusicToggle;
    private void Awake()
    {
        Time.timeScale = 1.0f;
    }
    private void Start()
    {
        Home.onClick.AddListener(()=>
        {

        });
        Music.onClick.AddListener(()=>
        {
            if(MusicToggle)
            {
                Music.GetComponent<Image>().sprite=MusicSprite[0];
                GetComponent<AudioSource>().Play();
            }
            else
            {
                GetComponent<AudioSource>().Pause();
                Music.GetComponent<Image>().sprite = MusicSprite[1];
            }
            MusicToggle=!MusicToggle;
        });
        Next.onClick.AddListener(()=>
        {
            Next.gameObject.SetActive(false);
            showGame.SetActive(true);
            hideGame.SetActive(false);
        });
    }
    public void ShowNextButton(GameObject show,GameObject hide)
    {
        showGame=show;
        hideGame=hide;
        Next.gameObject.SetActive(true);
    }
}
